package com.markerhub.common.lang;

import lombok.Data;

import java.io.Serializable;

@Data
public class Result implements Serializable {
    private String code;//错误为200
    private String msg;
    private Object data;
    public static Result succ(Object data) {
        return Result.succ("操作成功",data);
    }
    public static Result succ(String mess, Object data) {
        Result m = new Result();
        m.setCode("200");
        m.setData(data);
        m.setMsg(mess);
        return m;
    }
    public static Result fail(String mess) {
        return Result.fail("400",mess,null);
    }
    public static Result fail(String mess, Object data) {
        return Result.fail("404",mess,data);
    }
    public static Result fail(String code,String mess, Object data) {
        Result m = new Result();
        m.setCode(code);
        m.setData(data);
        m.setMsg(mess);
        return m;
    }
}
